package com.tanhua.dubbo.api;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.itheima.model.pojo.Character;
import com.tanhua.dubbo.mapper.CharacterMapper;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

@DubboService
public class CharacterApiImpl implements CharacterApi {

    @Autowired
    private CharacterMapper characterMapper;

    @Override
    public Character findBySign(Integer flag) {
        return characterMapper.selectOne(
                Wrappers.lambdaQuery(Character.class)
                        .eq(Character::getSign, flag)
        );
    }

    @Override
    public Character findById(Long characterId) {
        return characterMapper.selectById(characterId);
    }
}
